#define  _CRT_SECURE_NO_WARNINGS


#include<stdio.h>
#include<string.h>

int main()
{
    int n = 0, k = 0;
    while (scanf("%d", &n) != EOF)
    {
        if (n == 0)
            break;
        char arr[1000][10] = { 0 };
        int i = 0, j = 0, max = 0, a[1000] = { 0 };
        for (i = 0; i < n; i++)
        {
            scanf("%s", arr[i]);
        }
        for (i = 0; i < n; i++)
        {
            for (j = 0; j < n; j++)
            {
                if (strcmp(arr[i], arr[j]) == 0)
                    a[i]++;
            }
        }
        for (i = 0; i < n; i++)
        {
            if (a[i] >= a[max])
                max = i;
        }
        puts(arr[max]);
    }

    return 0;
}